package com.only4play.productcenter.api.constans;

import com.only4play.common.constants.BaseEnum;

import java.util.Optional;

/**
 * 商品序列化类型是否可量化
 */

public enum SerializeType implements BaseEnum<SerializeType> {

  SERIALIZE(1, "可量化"),
  NON_SERIALIZE(2, "非量化");

  SerializeType(Integer code, String name) {
    this.code = code;
    this.name = name;
  }

  private Integer code;
  private String name;

  @Override
  public Integer getCode() {
    return this.code;
  }

  @Override
  public String getName() {
    return this.name;
  }

  public static Optional<SerializeType> of(Integer code) {
    return Optional.ofNullable(BaseEnum.parseByCode(SerializeType.class, code));
  }

}
